﻿/*
 * @file: CartItem.cs
 * @type: Entity
 */
using System;
using BLL;

/// <summary>
/// Summary description for CartItem
/// </summary>
public class CartItem : IEquatable<CartItem>
{
    private Bouquet BouquetItem { get; set; }

    public int BouquetID { 
        get { return BouquetItem.BouquetID; }
        set { BouquetItem.BouquetID = value; }
    }
    public int Quantity { get; set; }
    public decimal UnitPrice {
        get { return BouquetItem.Price; }
    }
    public String BouquetName { 
        get { return BouquetItem.Name; } 
    }
    public decimal TotalPrice { get { return UnitPrice * Quantity; }}

    public bool Equals(CartItem item) {
        return item.BouquetID == this.BouquetID;
    }

	public CartItem(int bouquetID)
	{
        try
        {
            BouquetItem = BouquetBLL.GetBouquetByBouquetID(bouquetID, true);
        }
        catch (Exception ex)
        {
            throw ex;
        }
	}
}
